#pragma once

#include "public/xDefine.h"

namespace xKernel
{
    static void xKernel_RegisterObjectsAndServices()
    {
        ////////////////////////////////////////service table definition//////////////////////////////////
        OBJINFO objTable[] =
        {
            DEFITEM(DEFGUID(1F,94,44,65,9F,C5,4b,08,BE,A0,AA,A9,82,39,AB,B9), DEFGUID(28,2D,F7,B2,77,56,4f,0f,A7,88,78,B4,F2,30,DC,1B), "xKernel.dll", "IxWnd")
            DEFITEM(DEFGUID(28,3C,DD,B0,A5,A5,41,e0,AD,F6,78,25,EA,00,24,E8), DEFGUID(93,69,E3,78,16,79,44,c4,A4,C1,E1,F3,29,35,F9,B9), "xKernel.dll", "IxCanvas")

            DEFITEM(DEFGUID(94,12,BC,E8,6E,22,42,1c,B8,F8,43,4D,7F,B9,29,69), DEFGUID(81,A7,EA,65,B3,92,4f,5c,A1,6A,61,D1,5E,4A,D7,D6), "xKernel.dll", "IxBrush")
            DEFITEM(DEFGUID(82,0A,7E,3D,87,23,4f,55,96,5E,72,C9,6C,8F,EC,69), DEFGUID(3E,E1,FB,15,8A,CA,4d,02,82,E3,2D,CB,99,80,DD,94), "xKernel.dll", "IxTexture")

            DEFITEM(DEFGUID(E9,34,11,C7,0E,73,43,1b,AF,E5,73,D8,81,A8,2C,21), DEFGUID(42,7C,8C,00,C2,15,4d,08,A4,59,AD,F5,3E,08,18,6C), "xKernel.dll", "IxView")
            DEFITEM(DEFGUID(79,83,1E,87,23,77,42,14,B3,DE,4E,58,43,92,6D,EF), DEFGUID(3B,CA,6D,24,04,6C,44,fc,A6,22,01,79,7D,26,3E,25), "xKernel.dll", "IxBrushView")
            DEFITEM(DEFGUID(94,F0,B4,50,E3,57,47,82,87,21,19,65,D3,B5,4B,BA), DEFGUID(1B,CD,64,9F,84,59,4f,39,AB,12,22,EC,CA,F9,2A,D3), "xKernel.dll", "IxLayoutHorizon")
            DEFITEM(DEFGUID(1B,CD,64,9F,84,59,4f,39,AB,12,22,EC,CA,F9,2A,D3), DEFGUID(AB,AE,34,9C,9A,02,49,16,B9,73,83,39,94,E1,2F,F2), "xKernel.dll", "IxLayoutVertical")
            DEFITEM(DEFGUID(D4,A2,B0,5B,E7,A1,4c,2c,A7,F0,9B,1F,34,6B,05,6D), DEFGUID(50,8C,11,6C,8F,6F,45,c9,82,30,DE,74,28,53,D7,FB), "xKernel.dll", "IxLayoutSchedule")
            DEFITEM(DEFGUID(3C,39,D0,F4,BF,D3,42,f8,AF,63,90,04,98,67,40,EB), DEFGUID(6A,71,ED,97,37,C4,44,36,91,5B,FF,55,18,9F,60,C0), "xKernel.dll", "IxLayoutSchedule")
        };

        ////////////////////////////////////////service table definition//////////////////////////////////
        OBJINFO serTable[] =
        {
            DEFITEM(DEFGUID(21,C6,B5,9B,EB,5B,4a,69,8F,3E,4C,C5,CD,AD,45,87), DEFGUID(BE,D7,05,AF,B7,04,44,f5,BE,D8,8E,3D,70,76,C9,D8), "xKernel.dll", "IxLayoutManager")
            DEFITEM(DEFGUID(09,11,EA,F8,D4,88,47,9a,A9,A4,B2,63,DE,D3,AA,C4), DEFGUID(4C,34,3B,CC,7E,F7,42,47,9D,2D,04,9A,50,78,AE,C6), "xKernel.dll", "IxAttributeManager")
            DEFITEM(DEFGUID(80,22,8E,12,46,ED,43,e5,BB,35,E6,34,06,3D,06,4B), DEFGUID(DB,6E,15,E6,B6,71,49,fd,9C,63,CB,88,3C,1D,D5,36), "xKernel.dll", "IxFileManager")
            DEFITEM(DEFGUID(B3,6D,53,5B,15,C2,4a,5e,B5,4E,F4,75,2A,DE,C5,CC), DEFGUID(0B,41,1F,6C,E5,39,46,bd,BC,72,25,88,8D,0E,D9,D7), "xKernel.dll", "IxDescManager")
            DEFITEM(DEFGUID(49,AE,78,E5,30,29,4c,51,AD,77,8F,0E,1B,4A,F5,EA), DEFGUID(4B,B0,C8,DF,B5,6B,4e,f7,9D,60,0C,D5,76,C0,E2,9C), "xKernel.dll", "IxWndManager")
            DEFITEM(DEFGUID(F2,EF,4F,2C,F7,82,42,33,9D,56,A0,57,2D,60,BA,C5), DEFGUID(3F,7B,74,35,5E,A7,4b,66,8D,36,6B,09,7A,B2,A3,01), "xKernel.dll", "IxBuilder")
        };

        int countObj = sizeof(objTable) / sizeof(ObjectInfo);

        for(int i = 0; i < countObj; i++)
        {
            ::xCommon::RegObject(*objTable[i].guid, *(objTable[i].guid + 1), CComBSTR(objTable[i].strPath), CComBSTR(objTable[i].progid));
        }

        countObj = sizeof(serTable) / sizeof(ObjectInfo);

        for(int i = 0; i < countObj; i++)
        {
            ::xCommon::RegService(*serTable[i].guid, *(serTable[i].guid + 1), CComBSTR(serTable[i].strPath), CComBSTR(serTable[i].progid));
        }
    }
}